﻿@{
    ViewBag.Title = "";
    var id = Model != null ? Model.ID : 0;
}
@model ZBJF.Warranty.Model.ProductType
<ul class="nav nav-tabs">
    <li><a href="/ProductType/">设备类型列表</a></li>
    <li class="active"><a href="/ProductType/Edit/@id">@(id > 0 ? "编辑设备类型" : "添加设备类型")</a></li>
</ul>
@using (Html.BeginForm("SaveProductType", "ProductType", FormMethod.Post, new { id = "inputForm", name = "inputForm", @class = "form-horizontal", enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.HiddenFor(c => c.ID)
    <div class="control-group">
        <label class="control-label">设备类型名称：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.ProductName, new { validate = "{required:true,messages:{required:'请输入设备类型名称'}}", onkeyup = "BrandChange()" })
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">排序：</label>
        <div class="controls">
            @Html.TextBoxFor(m => m.Sort)
        </div>
    </div>
    <div class="control-group">
        <label class="control-label"></label>
        <div class="controls">
            <label>
                @Html.CheckBox("IsAvailable", Model != null && Model.IsAvailable)
                是否可用
            </label>
        </div>
    </div>
    <div class="form-actions">
        <input id="btnSubmit" class="btn btn-primary Edit-R" type="button" value="保存" onclick="loading(this)"  >  
        <input id="btnCancel" class="btn" type="button" value="重置" onclick="reset()">
    </div>
}
@section scripts{
    <script>
        function reset() {
            document.getElementById("inputForm").reset();
        }
        function loading(_this){
            if ($("#inputForm").valid()) {
                _this.disabled = 'disabled';
                document.getElementById("inputForm").submit();
            }
        }
    </script>
}